import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'
import Layout from '@/layout/index.vue'

const routes: Array<RouteRecordRaw> = [
  {
    path: "/",
    redirect:'login',
    name: "/",
  },
  {
    path: "/login",
    component: () => import('@/views/login/login.vue'),//配置所要调用的页面
    name: "login",
  },
  {
    path: '/home',
    component: Layout,
    redirect: '/dashboard',
    children: [
      {
        path: '/dashboard',
        component: () => import('@/layout/dashboard.vue'),
        name: 'dashboard',
        meta: {
          title: '首页',
          icon: '#icondashboard'
        }
      },
      {
        path: "/adminUser",
        component: () => import('@/views/system/AdminUser.vue'),
        name: "adminUser",
        meta: {
          title: "管理员管理",
          icon: "UserFilled",
          roles: ["sys:adminUser"],
        }
      },
      {
        path: "/userList",
        component: () => import('@/views/system/UserList.vue'),
        name: "userList",
        meta: {
          title: "用户管理",
          icon: "Wallet",
          roles: ["sys:userList"],
        }
      },
      {
        path: "/menuList",
        component: () => import('@/views/menu/index.vue'),
        name: "menuList",
        meta: {
          title: "菜单管理",
          icon: "Menu",
          roles: ["sys:menu"],
        }
      },
      {
        path: "/goodsType",
        component: () => import('@/views/goods/GoodsType.vue'),
        name: "goodsType",
        meta: {
          title: "商品分类",
          icon: "UserFilled",
          roles: ["sys:goodsType"],
        }
      },
      {
        path: "/unusedList",
        component: () => import('@/views/goods/UnusedList.vue'),
        name: "unusedList",
        meta: {
          title: "商品管理",
          icon: "Wallet",
          roles: ["sys:unusedList"],
        }
      },
      {
        path: "/jubaoList",
        component: () => import('@/views/jubao/jubaoList.vue'),
        name: "jubaoList",
        meta: {
          title: "举报管理",
          icon: "WarningFilled",
          roles: ["sys:jubaoList"],
        }
      },
      {
        path: "/bannerList",
        component: () => import('@/views/banner/Index.vue'),
        name: "bannerList",
        meta: {
          title: "广告列表",
          icon: "UserFilled",
          roles: ["sys:bannerList"],
        }
      }
    ]
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})


export default router